using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Terra.Data.Entities.Logging;

/// <summary>
/// 登录日志实体
/// </summary>
[Table("LoginLogs")]
[Comment("登录日志表")]
[Index(nameof(UserName))]
[Index(nameof(LoginTime))]
public class LoginLog : LogEntityBase
{
    /// <summary>
    /// 用户名
    /// </summary>
    [Required]
    [MaxLength(256)]
    [Comment("登录用户名")]
    public string UserName { get; set; }

    /// <summary>
    /// 登录时间
    /// </summary>
    [Required]
    [Comment("登录时间")]
    public DateTime LoginTime { get; set; }

    /// <summary>
    /// 登录状态
    /// </summary>
    [Required]
    [Comment("登录状态：true成功，false失败")]
    public bool Status { get; set; }

    /// <summary>
    /// 错误信息
    /// </summary>
    [MaxLength(512)]
    [Comment("登录失败时的错误信息")]
    public string ErrorMessage { get; set; }

    /// <summary>
    /// 登录方式
    /// </summary>
    [Required]
    [MaxLength(32)]
    [Comment("登录方式：Password密码、OAuth第三方等")]
    public string LoginMethod { get; set; }


    ///// <summary>
    ///// 登录类型
    ///// </summary>
    //[MaxLength(32)]
    //[Comment("登录类型：1登录, 2登出")]
    //public int Type { get; set; }

}